package com.zzyl.serve.controller;

import com.zzyl.serve.domain.NursingProject;
import com.zzyl.serve.service.INursingProjectService;
import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 专为小程序旧路径兼容设计的控制器
 * 路径：/member/orders/project/page
 */
@RestController
public class MemberOrderProjectController extends BaseController {

    @Autowired
    private INursingProjectService nursingProjectService;

    /**
     * 兼容前端旧路径：/member/orders/project/page
     * 注意：此 Controller 没有 @RequestMapping，所以路径是根级
     */
    @GetMapping("/member/orders/project/page")
    public TableDataInfo listForMember(
            @RequestParam(defaultValue = "1") Integer pageNum,
            @RequestParam(defaultValue = "10") Integer pageSize) {

        // ✅ 正确调用：无参
        startPage();

        // 查询所有上架的护理项目
        List<NursingProject> list = nursingProjectService.selectNursingProjectListByStatus(1);

        return getDataTable(list);
    }
}